<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%-- 引入页面头 --%>
<%@ include file="/pageHead.jsp"%>
<form name="form1" id="form1"
	action="<%-- ${systemctx}/sample/saveSample.web --%>" method="post">
	<div class="pageMain">
		<div class="pageTitle"><%=MessageResourcesUtils.getMessage(request, "systemmanage.bascsetting.title")%><span></span>
		<%=MessageResourcesUtils.getMessage(request, "dailyoperation.menuauthoritymanage.title") %><span></span>
		<%=MessageResourcesUtils.getMessage(request, "dailyoperation.menuauthoritymanage.list") %></div>
		<div class="pageBody">
			<div class="form-group">
				<ul>
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.menuauthoritymanage.type") %></label>
						<span><select id="type" name="type"></select></span>
					</li>
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.menuauthoritymanage.url") %></label>
						<span><input type="text" id="url" name="url" /></span>
					</li>
					
				</ul>
			</div>
		</div>
		<div class="button-group">
			
			<input type="button" class="btn btn-default" id="butQuery" name="butQuery" value="<%=MessageResourcesUtils.getMessage(request, "common.button.query") %>" />
			<input type="button" class="btn btn-default" id="butAdd" name="butAdd" value="<%=MessageResourcesUtils.getMessage(request, "common.button.add") %>" />
		</div>
		<table width="100%">
			<tbody>
				<tr>
					<td>
						<table id="datagrid"></table>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</form>
<script type="text/javascript">
	$(document).ready(function() {
		$("#type").selectutil({
			optModel : <%=SysConstant.RequestMenuType.getMode1JSONString(true,false)%>,
			optDefault : ''
		});
		
		//加载分页控件 datagrid
		$('#datagrid').issdatagrid({
			formid : 'form1',
			title : '<%=MessageResourcesUtils.getMessage(request, "dailyoperation.menuauthoritymanage.list") %>',
			width : 'auto',
			nowrap : true,
			autoRowHeight : false,
			singleSelect : true,
			striped : true,
			//collapsible:true,
			url : '${systemctx}/dailyoperation/menuauthoritymanage/querymenuauthoritymanageListInfoDataGrid.json',
			sortName : 'modifytime',
			sortOrder : 'desc',
			remoteSort : true,
			idField : 'id',
			pagination : true,
			rownumbers : true,
			showFooter : true,
			queryParams:$('#form1').serializeObject(),
			columns : [ [ 
				{
					field : 'id',
					title : '<%=MessageResourcesUtils.getMessage(request, "common.button.operation") %>',
					width : 100,
					align : 'center',
					formatter : operate
				},{
					title : '<%=MessageResourcesUtils.getMessage(request, "dailyoperation.menuauthoritymanage.menuid") %>',
					field : 'menuid',
					width : 60,
					sortable : true,
					align : 'right'
				},{
					title : '<%=MessageResourcesUtils.getMessage(request, "dailyoperation.menuauthoritymanage.menuname") %>',
					field : 'menuname',
					width : 150,
					sortable : true,
					align : 'left'
				},{
					title : '<%=MessageResourcesUtils.getMessage(request, "dailyoperation.menuauthoritymanage.type") %>',
					field : 'type',
					width : 100,
					sortable : true,
					align : 'center'
				},{
					title : '<%=MessageResourcesUtils.getMessage(request, "dailyoperation.menuauthoritymanage.url") %>',
					field : 'url',
					width : 730,
					sortable : true,
					align : 'left'
				} ] ],
				onLoadSuccess : function(data) {
					//显示AJAX请求后的提示信息
				}
			});

			$('#butQuery').click(function() {
				$('#datagrid').datagrid('load',$('#form1').serializeObject());
			});
			
			$('#butAdd').click(function(){
				
				$(this).isswindow({
					noheader : true,
					url : '${systemctx}/dailyoperation/menuauthoritymanage/toAddMenuAuthorityManage.web'
				});
			})
			
			function operate(val, row) {
				
					return '<a href="javascript:void(0);" class="easyui-linkbutton" onclick="menuauthoritymanageupdate('
						+ val + ')"><%=MessageResourcesUtils.getMessage(request, "common.button.update") %></a> ' +
							'<a href="javascript:void(0);" class="easyui-linkbutton" onclick="menuauthoritymanagedelete('
						+ val + ')"><%=MessageResourcesUtils.getMessage(request, "common.button.delete") %></a> ';
			}
	});
	
	function menuauthoritymanagedelete(val){
		var id = val;
		if (confirm("<%=MessageResourcesUtils.getMessage(request, "alertinfo.common.jsp.alert2") %>")) {
			//正在执行...
			showSending();
			$.ajax({
				type : 'GET',
				url : '${systemctx}/dailyoperation/menuauthoritymanage/doDeleteMenuAuthorityManage.json?id=' + id,
				dataType : 'json',
				success : function(data) {
					//关闭执行...
					closeSending();
					//显示AJAX请求后的提示信息
					$.fn.ajaxmessage(data);
					$('#datagrid').datagrid('reload',
					$('#form1').serializeObject());
					$('#datagrid').datagrid('clearSelections');
				}
			});
		}
	}
	
	function menuauthoritymanageupdate(val){
		var id = val
		$(this).isswindow({
			noheader : true,
			url : '${systemctx}/dailyoperation/menuauthoritymanage/toUpdateMenuAuthorityManage.web?id='+id
		});
	}
</script>
<%-- 引入页面尾 --%>
<%@ include file="/pageFloor.jsp"%>